package com.zjs.jvm;

import lombok.extern.slf4j.Slf4j;

/**
 * @Description TODO
 * @Author zhu_jinsheng[zhu_js@suixingpay.com]
 * @Date 2020/1/8 13:28
 * @Version 1.0
 */
@Slf4j
public class TestGc {
    /**
     * 编译器在编译代码的时候就将值计算好了，效率更高
     */
    private static final int _2MB = 1024*1024*2;
    private byte[] data=new byte[_2MB];

    public static void main(String[] args) {
        int i = 1;
        while (i < 5000) {
            TestGc test=new TestGc();
//            log.info("最大内存{}",Runtime.getRuntime().maxMemory());
//            log.info("全部内存{}",Runtime.getRuntime().totalMemory());
//            log.info("空闲内存{}",Runtime.getRuntime().freeMemory());
            GCInfo.getGcInfo(i);
            i++;
        }
    }
}
